<%@ page import="com.uni.entity.User" %>
<%@ page import="com.uni.entity.CommodityType" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  <title>闲优购-发布商品</title>
    <link rel="icon" href="img/weblogo.png" >
  <link rel="stylesheet" type="text/css" href="bootstrap-5.1.3-dist/css/bootstrap.min.css"/>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link rel="stylesheet" type="text/css" href="css/ycc.css">
    <script type="text/javascript" src="js/jquery-3.6.0-min.js"></script>
    <script type="text/javascript" src="js/jquery-form-min.js"></script>
    <script type="text/javascript" src="bootstrap-5.1.3-dist/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="js/commodity_publish.js"></script>
<body>
    <!--首部导航栏-->
    <nav class="navbar navbar-dark bg-dark navbar-expand-lg">
        <div class="container-fluid text-white">
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
                <h5 class=""><i class="bi bi-cart4"></i>闲优购</h5>
                <ul class="navbar-nav me-lg-2 mb-0 mb-lg-1">
                    <li class="nav-item">
                        <a class="nav-link active" aria-current="page" href="index.jsp"><i class="bi bi-house"></i>首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/shop_center"><i class="bi bi-shop"></i>商品中心</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="user_center.jsp"><i class="bi bi-cart-check"></i>查询订单</a>
                    </li>

                    <li class="nav-item">

                        <a class="nav-link" href="commodity_publish.jsp"><i class="bi bi-shift"></i>发布商品</a>
                    </li>

                </ul>

                <ul class="navbar-nav" style="margin-left: auto">

                    <li class="nav-item">
                        <a class="nav-link" href="user_center.jsp">
                            <i class="bi bi-clock-history"></i>
                            查询购买记录
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="user_center.jsp">
                            <i class="bi bi-person-fill"></i>
                            用户中心
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/loginOut">
                            <i class="bi bi-backspace-reverse"></i>
                            退出登陆
                        </a>
                    </li>

                </ul>

                当前用户: <em id="username">${sessionScope.userInfo.name}</em>

            </div>
        </div>
    </nav>

    <!--添加商品部分 -->
    <div class="container card-publish">
      <nav class="card shadow mb-3 text-center">

          <div class="card-header">
              <h5>发布商品</h5>
          </div>
            <form id="form-publish" class="text-center row">
              <!-- 选择商品图片部分 -->
              <div class="col-md-6">
                <button class="form-publish-img-parent">
                  <input id="form-publish-img" name="form-publish-img" type="file" class="d-block">
                </button>

                <button>
                  <img id="form-publish-img-show" src="img/add_image.jpg">
                </button>
              </div>
                <!-- 填商品信息表部分 -->
              <div class="col-md-6">

                  <nav class="card-body">
                      <!-- 商品名称部分 -->
                      <img src="img/logo.jpg" class="w-75">
                      <div class="row mt-4">
                        <h6 class="col-md-2 offset-md-2">商品名称</h6>
                        <input id="commodity-name" class="col-md-6 order-md-3" name="commodity-name" type="text">
                      </div>
                      <!-- 商品描述部分 -->
                      <div class="row mt-4">
                        <h6 class="col-md-2 offset-md-2">商品描述</h6>
                        <input id="commodity-info" class="col-md-6 order-md-3" name="commodity-info" type="text">
                      </div>
                      <!-- 商品类型部分 -->
                      <div class="row mt-4">
                        <h6 class="col-md-2 offset-md-2">商品类型</h6>
                        <select id="commodityType" class="col-md-6 order-md-3" name="commodityType">
                          <c:if test="${not empty sessionScope.commodityTypes}">
                            <c:forEach items="${sessionScope.commodityTypes}" var="ct">
                              <option value="${ct.id}">
                                ${ct.info}
                              </option>
                            </c:forEach>
                          </c:if>
                        </select>
                      </div>
                      <!-- 商品价格部分 -->
                      <div class="row mt-4">
                        <h6 class="col-md-2 offset-md-2">商品价格</h6>
                        <input id ="commodity-price" class="col-md-6 order-md-3" name="commodity-price" type="text">
                      </div>
                  </nav>
              </div>
                <div class="container">
                    <button id="form-button" type="button" class="btn btn-success mb-3 w-75">
                        上架商品
                    </button>
                </div>
          </form>
      </nav>

      </div>

    </div>
</body>
</html>
